package net.xdclass.springboot.Listener;

import jakarta.servlet.ServletContextEvent;
import jakarta.servlet.ServletContextListener;
import jakarta.servlet.annotation.WebListener;

@WebListener
  public class MyContextListener implements ServletContextListener {
      @Override
      public void contextInitialized(ServletContextEvent sce) {
          // 上下文初始化操作
          System.out.println("ServletContext initialized");
      }

      @Override
      public void contextDestroyed(ServletContextEvent sce) {
          // 上下文销毁操作
          System.out.println("ServletContext destroyed");
      }
  }